package com.yuandian.customer.perception.controller;

import com.yuandian.api.customer_perception.po.VisitReportParams;
import com.yuandian.api.management.feign.RemoteOptionService;
import com.yuandian.bpm.common.core.util.R;
import com.yuandian.customer.perception.service.VisitReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author liXin
 * @description 访问报表
 * @date 2022/5/23
 */
@RestController
@RequestMapping("/visitReport")
public class VisitReportController {

    @Autowired
	VisitReportService visitReportService;

    @Autowired
	RemoteOptionService searchOptionService;

    /**
     * 报表菜单页面访问总览
     * @return
     */
    @PostMapping("getReportInfo")
    public R getReportInfo(@RequestBody VisitReportParams params){
        return visitReportService.getReportInfo(params);
    }

    /**
     * 报表菜单页面访问总览
     * @return
     */
    @PostMapping("visitOverride")
    public R visitOverride(@RequestBody VisitReportParams params){
        return visitReportService.visitOverride(params);
    }

    /**
     * 报表菜单页面访问总览
     * @return
     */
    @PostMapping("userVisitOverride")
    public R userVisitOverride(@RequestBody VisitReportParams params){
        return visitReportService.userVisitOverride(params);
    }

    /**
     * 用户访问明细
     * @return
     */
    @PostMapping("userVisitDetail")
    public R userVisitDetail(@RequestBody VisitReportParams params){
        return visitReportService.userVisitDetail(params);
    }


    /**
     * 下载所有数据
     *
     * @return 通用返回对象
     */
    @PostMapping("/exportAllData")
    public void exportAllData(@RequestBody VisitReportParams params, HttpServletResponse response) {

        visitReportService.exportAllData(params, response);
    }

    /**
     * 查询菜单下拉
     *
     * @return 通用返回对象
     */
    @GetMapping("/getMenuList")
    public R getMenuList() {

        List<Map<String, String>> menuList = new ArrayList<>();
//				searchOptionService.getMenuList(null);
        return R.ok(menuList);
    }


}
